package com.dailyblue.java.spring.boot.simple.example.controller;

import com.dailyblue.java.spring.boot.simple.example.bean.DemoA;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController  // === @Controller+@ResponseBody
@RequestMapping("/second")
@Slf4j  // 这个是一个日志注解
public class SecondController {
    @Resource
    private DemoA da;

    @RequestMapping("/a")
    public DemoA a() {
        return da;
    }

    @RequestMapping("/b")
    public String b(Integer i) {
        log.info("进入了SecondController`b 方法,接收参数：{}", i);
        int num = i.intValue();
        int result = 9 / num;
        log.info("9除以{}，结果是:{}", num, result);
        return "This is SecondController`b method!";
    }

}
